V = Variable
C = Calculation
The VC10Cr32Init function is part of a collection of functions to calculate the CRC of a sequence of data. The VC10Cr32Init function need to initialize data and data structures are involved in the calculation. Other functions that are part of the collection are:
VC10Cr32Beg Beginning of the procedure
VC10Cr32Udt Update of the procedure
VC10Cr32Calc Calculation procedure
VC10Cr32Init ( crc32arTab, crc32Value )
Initializes the array of at least 256 elements that contains the parameters for the calculation of the CRC and the CRC value.
| IN/OUT | VARIABLE TYPE | EXAMPLE NAME | DIM | |
|---|---|---|---|---|
| OUT | ARRGBL | crc32arTab | L | Array of at least 256 elements containing the table of parameters to calculate the CRC. |
| OUT | GLOBAL | crc32Value | L | Variable to be initialized to contain the value of the CRC. |
VC10Cr32Beg ( crc32arTab, crc32Value )
Assign the initial value of the CRC
| IN/OUT | VARIABLE TYPE | EXAMPLE NAME | DIM | |
|---|---|---|---|---|
| IN | ARRGBL | crc32arTab | L | Array of at least 256 elements containing the table of parameters to calculate the CRC. |
| OUT | GLOBAL | crc32Value | L | Variable used to hold the value of the CRC. |
VC10Cr32Udt ( crc32arTab, crc32Value, crc32DataIn )
Updates the value of the CRC for any new acquired datas.
| IN/OUT | VARIABLE TYPE | EXAMPLE NAME | DIM | |
|---|---|---|---|---|
| IN | ARRGBL | crc32arTab | L | Array of at least 256 elements containing the table of parameters to calculate the CRC. |
| OUT | GLOBAL | crc32Value | L | Variable used to hold the value of the CRC. |
| IN | GLOBAL | crc32DataIn | L | New value to update the calculation |
VC10Cr32Calc ( crc32arTab, crc32Value, crc32DataIn )
CRC calculation concludes once gone are the data.
| IN/OUT | VARIABLE TYPE | EXAMPLE NAME | DIM | |
|---|---|---|---|---|
| IN | ARRGBL | crc32arTab | L | Array of at least 256 elements containing the table of parameters to calculate the CRC. |
| OUT | GLOBAL | crc32Value | L | Variable to be initialized to contain the value of the CRC. |
VC10Cr32Init( ImedCrcTab, LImedCrcC )
MAIN:
IF Start_Calc EQ 1
VC10Cr32Beg( ImedCrcTab, LImedCrcC )
FOR (Index = 1, Index LE DIM_ARRAY, 1)
;Adds a new data to calculate the CRC taking it from an array
TmpLong = ArrayLong[Index]
VC10Cr32Upt( ImedCrcTab, LImedCrcC, TmpLong)
NEXT
VC10Cr32Calc ( ImedCrcTab, LImedCrcC ) ;Conclusion of the calculation of the CRC
Start_Calc = 0
ENDIF
WAIT 1
JUMP MAIN
END